S = "abcabc"


function solution(S) {
    let Hash = {}
    let count = 0
    for (let i = 0; i < S.length; i++) {
        if (Hash[S[i]] === undefined) {
            Hash[S[i]] = 1
        }
        else {
            Hash[S[i]]++
        }
    }
    for (let key in Hash) {
        count += Math.floor(Hash[key] / 2)
    }
    return count
}
console.log(solution(S));
